/**********************************************************************
 *
 *  MODULE: GNUMBEREDEDIT.CPP
 *  AUTHOR: BRIAN M. WORKMAN
 *  START DATE: 4/4/2006 8:21:07 PM
 *
 **********************************************************************/

#include "gnumberededit.h"
#include <QtDebug>

GNumberedEdit::GNumberedEdit(QWidget *parent) {
    QHBoxLayout *h = new QHBoxLayout(this);
    setLayout(h);
    m_edit = new GDoc(this);
    m_lines = new DevLineNumber(m_edit, this);
    m_edit->setFrameShape(QFrame::Box);
    h->addWidget(m_lines);
    h->addWidget(m_edit);
    h->setMargin(0);
    h->setSpacing(2);
    
    connect(m_edit, SIGNAL(textChanged()), this, SLOT(changed()));

    m_parent = parent;
}

void GNumberedEdit::changed() {
    //emit textChanged(this);
    emit textChanged();
}

GDoc* GNumberedEdit::edit() {
    return m_edit;
}

QTextDocument* GNumberedEdit::doc() {
    return m_edit->document();
}

void GNumberedEdit::setViewLineNumbers(bool yn) {
    m_lines->setVisible(yn);
}

bool GNumberedEdit::viewLineNumbers() const {
    return m_lines->isVisible();
}
